package com.lincoln.framework.interfaces;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;

import java.util.List;

/**
 * 基本的解码器
 * @author lincoln
 */
public class BaseDecoder extends Decoder {
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
        byte[] byteArray = new byte[byteBuf.readableBytes()];
        byteBuf.readBytes(byteArray);
        String result = new String(byteArray, "UTF-8");
        list.add(result);
    }
}
